/*
 * JRoverSub.h
 *
 *  Created on: Dec 2, 2012
 *      Author: bouchier
 */
/*! \file JRoverSub.h
 * \brief The include file for the jRoverSubsumption class
 */

#ifndef JROVERSUB_H_
#define JROVERSUB_H_

class Layer;
class Cruise;
class StopBot;
class Metro;
class CTextLCD;

class JRoverSub {
public:
	JRoverSub();
	virtual ~JRoverSub();
	int go();
	char *getActiveLayerName() 	{return(activeLayerName);}
	int getAlgorithm() 	{return(algorithm);}
	void setAlgorithm(int algIn);
	int getParam() 		{return(param);}

private:
	int *wayPointList;
	char *activeLayerName;
	int algorithm;
	int param;
	float rqVLinear;					// requested linear speed
	float rqVAngular;					// requested angular speed

	StopBot *stopBot;                   // the default layer
	Cruise *cruise;
	RangeBackoff *rangeBackoff;
	RangeFollower *rangeFollower;


	Layer *activeLayer;      			// output, subsumption layer chosen by arbitrator()
	Layer *lastActiveLayer;
	Layer *algLayers[16];				// allow up to 16 layers per algorithm

	Layer **layerList;                  // pointer to job priority list
	int layerCount;                   	// number of tasks in priority list
	int arbitrateEnable;              	// global flag to enable subsumption
	int halt;                   		// global flag to halt robot
	int runTime;						// how long to run for, 0 is forever

	int arbitrate();
};

#endif /* JROVERSUB_H_ */
